import requests
import app
import utils


# 创建接口类

class LoginApi:

    # 登录
    def login(self, login_data):
        return requests.post(url=app.url_login, json=login_data)

    # 员工管理
    def login_getuserlist(self, aa):
        return requests.get(url=app.url_get_user, headers={"Authorization": aa})

    # 员工添加
    def insert_user(self, add_data, aa):
        return requests.post(url=app.url_add_user, json=add_data, headers={"Authorization": aa})

    # 员工修改
    def updata_user(self, put_id, put_data, aa):
        return requests.put(url=app.url_put_user.format(put_id), json=put_data, headers={"Authorization": aa})

    # 员工查询
    def select_user(self, put_id, aa):
        return requests.get(url=app.url_put_user.format(put_id), headers={"Authorization": aa})

    # 员工删除
    def delete_user(self, put_id, aa):
        return requests.delete(url=app.url_put_user.format(put_id), headers={"Authorization": aa})




if __name__ == '__main__':
    print(LoginApi().login(app.login_data).json())
